<?php
namespace app\admin\service;

use app\model\FollowUserModel;
use app\model\InterfereUserModel;
use think\Service;

class InterfereService extends Service
{
    public string $message;

    public function FollowUserUpdate($data)
    {
        $FollowUserModel = new FollowUserModel();
        $info = $FollowUserModel->find($data['id']);
        if (!$info) return false;
        if (!empty($data['up_content'])){
            $data['up_num'] = count($data['up_content']);
            $data['up_content'] = json_encode($data['up_content'],true);
        }else{
            $data['up_num'] = 0;
            $data['up_content'] = '';
        }
        return $info->save($data);
    }

    public function InterfereUserUpdate($data)
    {
        $InterfereUserModel = new InterfereUserModel();
        $info = $InterfereUserModel->find($data['id']);
        if (!$info) return false;
        if (!empty($data['up_content'])){
            $data['up_num'] = count($data['up_content']);
            $data['up_content'] = json_encode($data['up_content'],true);
        }else{
            $data['up_num'] = 0;
            $data['up_content'] = '';
        }
        return $info->save($data);
    }
}